package cn.net.yugu.doraemon.event.spring;

import java.io.Serializable;

import lombok.Data;

/**
 * @author xiangzhurui
 * @version 2022/12/24 10:21:17
 */
@Data
public class EventBusProperties implements Serializable {

    private static final long serialVersionUID = 3917548346994668763L;

    private String eventBusType = "guava";

    private AsyncEventBusProperties asyncEventBus;

    public EventBusProperties setEventBusType(EventBusType eventBusType) {
        if (eventBusType != null) {
            this.eventBusType = eventBusType.getCode();
        }
        return this;
    }

    public EventBusProperties setEventBusType(String eventBusType) {
        this.eventBusType = eventBusType;
        return this;
    }

    @Data
    public static class AsyncEventBusProperties implements Serializable {

        private static final long serialVersionUID = -3269790544681792630L;
        private Integer corePoolSize = 2;
        private Integer maximumPoolSize = 8;
        private Integer queueCapacity = 1024;

        private String threadName;

        private Boolean armsEnabled = false;
    }
}
